package com.egrid.point.bury.code;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * PageResponse.java
 * Created at 2019-12-31
 * Created by Royal Warmer
 * Copyright (C) 2018 SAIC VOLKSWAGEN, All rights reserved.
 */
@ApiModel("分页显示")
public class PageResponse extends AbstractResponse {

    @ApiModelProperty("总计")
    private Long total;

    @ApiModelProperty("当前页数据行数")
    private Integer rows;

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Integer getRows() {
        return rows;
    }

    public void setRows(Integer rows) {
        this.rows = rows;
    }

    public PageResponse(String code, String message, Object content, Long total, Integer rows) {
        this.code = code;
        this.message = message;
        this.content = content;
        this.total = total;
        this.rows = rows;
    }

    public PageResponse() {
    }

    public static PageResponse success(Object content, Long total, Integer rows) {
        return new PageResponse("200", "查询成功", content, total, rows);
    }


    public static PageResponse fail(Object content, Long total, Integer rows) {
        return new PageResponse("500", "查询失败", content, total, rows);
    }

}
